home *** CD-ROM | disk | FTP | other *** search
- ; This batch file creates a plot used in Chapter 10, "Plotting",
- ; of _Using IDL_.
-
- ; Create a data array.
-
- X = FLTARR(256)
-
- ; Make a step function. Array elements 80 through 120 are set to 1.
-
- X(80:120) = 1
-
- ; Make a filter.
-
- FREQ = FINDGEN(256)
-
- ; Make the filter symmetrical about the value x =128.
-
- FREQ = FREQ < (256-FREQ)
-
- ; The filter is a second order Butterworth filter,
- ; with a cutoff frequency = 20.
-
- FIL = 1./(1+(FREQ/20)^2)
-
- ; Plot with a logarithmic x-axis. Use exact axis range.
-
- PLOT, /YLOG, FREQ, ABS(FFT(X,1)), $
- XTITLE = 'Relative Frequency', YTITLE = 'Power', XSTYLE = 1
-
- ; Plot graph.
-
- OPLOT, FREQ, FIL
-